"""
    Created By Khun on 2020/6/30
"""

__author__ = 'Khun'

import xadmin
from invoice.models import InvoiceList
from utils.constants import PAGE_SIZE


class InvoiceAdmin(object):
    """ 开单/退款 """
    list_display = ('project', 'reimbursement', 'created_at', 'amount', 'is_invoice', 'approver', 'remark')
    list_filter = ('project', 'reimbursement', 'created_at', 'is_invoice')
    search_fields = ('project', 'reimbursement', 'is_invoice')
    list_per_page = PAGE_SIZE  # 分页的页数
    model_icon = 'fa fa-file-text'
    show_bookmarks = False  # 关闭书签功能
    reversion_enable = True
    aggregate_fields = {'amount': 'sum'}
    list_editable = ('created_at', 'amount', 'is_invoice', 'approver')


xadmin.site.register(InvoiceList, InvoiceAdmin)
